// package: rewords-server-2024
// filename: router
// author: diogoxiang@gmail.com
// time: 2024/11/11 10:07

package router

import (
	"context"

	"github.com/gogf/gf/v2/net/ghttp"

	"rewords-server-2024/internal/consts"
	"rewords-server-2024/internal/controller/admin"
	"rewords-server-2024/internal/service"
	"rewords-server-2024/utility/simple"
)

func Admin(ctx context.Context, group *ghttp.RouterGroup) {
	group.Group(simple.RouterPrefix(ctx, consts.AppAdmin), func(group *ghttp.RouterGroup) {
		// 限流 默认配置
		group.Middleware(service.Middleware().RateLimit())

		// 验证权限
		group.Middleware(service.Middleware().AdminAuth)

		// bind controller
		group.Bind(
			admin.Menu, // 菜单管理
			admin.OpenUser,
			admin.App,       // 应用管理
			admin.Dict,      // 字典管理
			admin.ComConfig, // 配置管理
			admin.Wuser,     // 用户管理 - 微信
			admin.AiCtrl,    // AI 管理及配置
		)

	})
}
